﻿Imports System
Imports System.Windows
Imports System.Windows.Forms



Public Class AutoCheckMenuButtonEmulsifier
	Inherits MenuButtonEmulsifier

	Protected bChecked As Boolean = False



	Public Sub New()

		MyBase.New()

	End Sub

	Public Sub New(menuItem As ToolStripMenuItem, button As ToolStripButton)

		MyBase.New(menuItem, button)

	End Sub

	Public Sub New(menuItem As ToolStripMenuItem, button As ToolStripButton, clickHandler As EmulsionClickDelegate)

		MyBase.New(menuItem, button, clickHandler)

	End Sub



	Protected Overrides Sub OnEmulsionClick()

		Me.Checked = Not Me.Checked

		MyBase.OnEmulsionClick()

	End Sub



	Public Property Checked As Boolean
		Get
			Return bChecked
		End Get
		Set(value As Boolean)
			bChecked = value
			If Not Nothing Is oMenuItem Then
				oMenuItem.Checked = bChecked
			End If
			If Not Nothing Is oButton Then
				oButton.Checked = bChecked
			End If
		End Set
	End Property

End Class
